home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / diskwarn / RCS / diskwarn,v < prev    next >
Text File  |  1991-06-05  |  2KB  |  74 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.1
  10. date     91.06.04.21.24.05;  author kupfer;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Script to check a filesystem domain's free space.
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @#! /sprite/cmds/csh -f
  27. #
  28. # Send mail to selected users if a disk partition gets below a certain
  29. # amount of free space.
  30.  
  31. # $Header: /sprite/lib/forms/RCS/proto.csh,v 1.5 91/02/09 13:24:51 ouster Exp $ SPRITE (Berkeley)
  32. #
  33. # Copyright 1991 Regents of the University of California
  34. # Permission to use, copy, modify, and distribute this
  35. # software and its documentation for any purpose and without
  36. # fee is hereby granted, provided that this copyright
  37. # notice appears in all copies.  The University of California
  38. # makes no representations about the suitability of this
  39. # software for any purpose.  It is provided "as is" without
  40. # express or implied warranty.
  41. #
  42.  
  43. if ($#argv < 3) then
  44.     echo "usage: diskwarn domain minfree user ..."
  45.     exit 1
  46. endif
  47.  
  48. set domain=$1
  49. set minfree=$2
  50. shift
  51. shift
  52.  
  53. # $argv is now the list of people to send mail to.
  54.  
  55. set dfline=(`df $domain |& tail -1`)
  56.  
  57. # If the first field isn't the name of the domain, it's probably an
  58. # error message.
  59.  
  60. if ($dfline[1] != $domain) then
  61.     echo "Couldn't df $domain" | mail -s diskwarn $argv
  62.     exit 1
  63. endif
  64.  
  65. # Since it's not an error message, the 5th field is the amount available.
  66.  
  67. if ($dfline[5] < $minfree) then
  68.     echo "Domain $domain is down to $dfline[5] KB" | \
  69.       mail -s diskwarn $argv
  70. endif
  71.  
  72. exit 0
  73. @
  74.